package com.og.backingbean;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.NotEmpty;

/**
 * @author Renaud DIANA
 *
 */
@Entity
@NamedQueries({@NamedQuery(name = "Solution.findAll", query = "SELECT s FROM Solution s ORDER BY s.idSolution ASC")})
public class Solution implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
	private int idSolution;
	@NotNull
	@NotEmpty
	@Size(max = 50)
	@Column(nullable = false, length = 50)
	private String name;
	private String link1;
	private String link2;
	private String link3;
	private String comments;
	@NotNull
	@ManyToOne
	@JoinColumn(nullable = false)
	private Bug bug;
	@OneToMany(mappedBy = "solution", cascade = CascadeType.ALL)
	@JoinColumn(name = "solution_idsolution")
	private List<Ticket> listTicket;
	
	/**
	 * Default constructor
	 */
	public Solution() {
		// TODO Auto-generated constructor stub
	}

	public int getIdSolution() {
		return idSolution;
	}

	public void setIdSolution(int idSolution) {
		this.idSolution = idSolution;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getLink1() {
		return link1;
	}

	public void setLink1(String link1) {
		this.link1 = link1;
	}

	public String getLink2() {
		return link2;
	}

	public void setLink2(String link2) {
		this.link2 = link2;
	}

	public String getLink3() {
		return link3;
	}

	public void setLink3(String link3) {
		this.link3 = link3;
	}

	public String getComments() {
		return comments;
	}

	public void setComments(String comments) {
		this.comments = comments;
	}

	public Bug getBug() {
		return bug;
	}

	public void setBug(Bug bug) {
		this.bug = bug;
	}

}
